import pickle

# 创建一个字典对象
data = {'name': 'John', 'age': 30, 'city': 'New York'}

# 序列化对象
with open('data.pkl', 'wb') as f:
    pickle.dump(data, f)

# 反序列化对象
with open('data.pkl', 'rb') as f:
    loaded_data = pickle.load(f)

print(loaded_data)

d = [1, 2, 3]
print(d)
for ad in d:
    print(type(ad))
# Remove redundant parentheses
b = [(1), (2), (3)]

print(b)
for a in b:
    print(type(a))

c = [(1,), (2,), (3,)]

print(c)
for aa in c:
    print(type(aa))

e = [x ** 2 for x in range(3, 11)]

print(e)

d = {'a': 24, 'g': 52, 'i': 12, 'k': 33}
sorted_d = dict(sorted(d.items(), key=lambda item: item[1]))
print(sorted_d)

for uu in d.items():
    print(uu[0])
    print(uu[1])
